package com.pureland.security.exceptions;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pureland.security.exceptions.serializers.Auth2ExceptionSerializer;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @projectName: pureland_cloud
 * @className: com.pureland.security.exceptions.Auth2Exception
 * @description: 自定义Oauth2Exception
 * @author: tong.li
 * @createTime: 2020/11/17 16:19
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 */
@Getter
@JsonSerialize(using = Auth2ExceptionSerializer.class)
public class Auth2Exception extends OAuth2Exception {

    private static final long serialVersionUID = -659122337217372L;
    private int messageId;
    private String message;
    protected HttpStatus httpStatus = HttpStatus.BAD_REQUEST;

    public Auth2Exception(String message) {
        super(message);
        this.message = message;
    }

    public Auth2Exception(String message, int messageId) {
        super(message);
        this.message = message;
        this.messageId = messageId;
    }
}
